//
//  HXBaseController.swift
//  HXSwift
//
//  Created by apple　　　 on 2016/11/22.
//  Copyright © 2016年 yangguang. All rights reserved.
//

import UIKit

class HXBaseController: UIViewController {
    
    
    //自定义标题
    lazy var navItem = UINavigationItem()
    
    //自定义NavgationBar
    lazy var navigationBar  = UINavigationBar(frame: CGRect(x: 0, y: 0, width:UIScreen.main.bounds.width, height: 64))
    
    override func viewDidLoad() {
        super.viewDidLoad()
              setupUI()
        
    }
    
  override var title: String? {
        
        didSet {
            
            navItem.title = title
        }
    }
    
}

extension HXBaseController {
    
    func setupUI()  {
        
        view.addSubview(navigationBar)
        
        navigationBar.items = [navItem]
        
        navigationBar.tintColor = UIColor.blue
        //修改标题字体颜色
        navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.darkGray]
        
    }

}
